const wxHttpHandler = require('../../utils/wxHttpHandler.js');
const api = require('../../APIConfig/apiConfig.js');

Page({
  data: {
    url:'',
    noticeType: '',
    noticeId: ''
  },

  onLoad: function (options) {
    wx.setNavigationBarTitle({
      title: options.title,
    })
    this.setData({
      noticeType: options.noticeType,
      noticeId: options.noticeId
    })
    this.queryNoticeContentById()
  },
  onShow: function () {},

  //公告详情
  queryNoticeContentById: function () {
    let data = {
      noticeType: this.data.noticeType,
      noticeId: this.data.noticeId
    }
    const that = this
    wx.showLoading()
    wxHttpHandler({
      type: 'get',
      path: api.queryNoticeContentById,
      data: data,
      fn: function (res) {
        if (res.code == 0) {
          that.setData({
            url: 'https://developers.weixin.qq.com/miniprogram/dev/framework/structure.html'
          })
          wx.hideLoading()
        } else {
          wx.hideLoading()
          wx.showToast({
            title: res.desc,
            icon: 'none',
            duration: 1500,
            mask: true
          });
        }
      }
    })
  },
})